let time = 0;
export const request= (params)=>{
  time++;
  let baseUrl = 'https://api-hmugo-web.itheima.net/api/public/v1'
    return new Promise((reslove,reject)=>{
      wx.showLoading({
        title: '加载中',
        mask:true
      })
      wx.request({
        ...params,
        url:baseUrl+params.url,
        success:(result)=>{
          reslove(result)
        },
        fail:(error)=>{
          reject(error)
        },
        complete:()=>{
          time--;
          if(time===0){
            wx.hideLoading()
          }
        }
      })
    })
  }